package it.aekidna.cleverplatypus.workflow.template
{
	import it.aekidna.cleverplatypus.workflow.AbstractWorkflowTask;

	public class EqualityCheckerTask extends AbstractWorkflowTask
	{
		public var sourceObject : Object;
		public var sourceProperty : Object;
		public var sourceValue : Object;

		public var destinationObject : Object;
		public var destinationProperty : Object;
		public var destinationValue : Object;


		override public function begin() : void
		{
			if( !this.sourceValue )
				this.sourceValue = ( this.sourceObject && this.sourceProperty && ( this.sourceObject.hasOwnProperty( this.sourceProperty ))) ? this.sourceObject[ this.sourceProperty ] : null;


			if( !this.destinationValue )
				this.destinationValue = ( this.destinationObject && this.destinationProperty && ( this.destinationObject.hasOwnProperty( this.destinationProperty ))) ? this.destinationObject[ this.destinationProperty ] : null;


			if( sourceValue == destinationValue )
				complete();
			//else
			//fail( 'Assertion failed' );
		}
	}
}